<form action='' method='POST' enctype='multipart/form-data'>
<input name='userFile'><br>
<input type='submit' name='upload_btn' value='upload'>
</form>
<?php

 $info = pathinfo($_POST['userFile']['name']);
 $ext = $info['extension']; // get the extension of the file
 $newname = "newname.".$ext; 

 $target = 'images/'.$newname;
 move_uploaded_file( $_POST['userFile']['tmp_name'], $target);

?>